package com.fengniu.ejb.dao;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.fengniu.ejb.entity.Content;
import com.fengniu.ejb.entity.Content2Category;
import com.fengniu.ejb.entity.Content2Content;

public interface IContentDao extends Serializable {

	// --------------------------Content--------------------------
	public Content saveContent(Content content);

	public void deleteContentByContentId(String contentId);

	public Content findContentBySysId(long contentSysId);

	public Content findContentByContentId(String contentId);

	/**
	 * find coupon is member of the leaf category
	 * 
	 * @param contentSysId
	 * @param relationId
	 * @param categoryTypeID
	 * @return
	 */
	public Content2Category findContentLeafCategoryBy(long contentSysId, Integer relationId, Integer categoryTypeId);

	/**
	 * get list contents
	 * 
	 * @param contentTypeIds
	 * @param statusIds
	 * @param beforeLastUpdatedDate
	 * @param pgno
	 * @param pgsize
	 * @param orderBy
	 * @return
	 */
	public List<Content> getListContentBy(Integer[] contentTypeIds, String[] statusIds, Date beforeLastUpdatedDate,
			int pgno, int pgsize, String orderBy);

	/**
	 * get count contents
	 * 
	 * @param contentTypeIds
	 * @param statusIds
	 * @param beforeLastUpdatedDate
	 * @return
	 */
	public long getCountContentBy(Integer[] contentTypeIds, String[] statusIds, Date beforeLastUpdatedDate);

	// --------------------------/Content--------------------------

	// --------------------------Content2Category--------------------------
	public Content2Category saveContent2Category(Content2Category content2Category);

	/**
	 * 
	 * @param contentId
	 * @param id
	 * @param id
	 * @return
	 */
	public Content2Category findContent2CategoryBy(String contentId, Integer relationId, String categoryId);

	/**
	 * find coupon is member of the leaf category
	 * 
	 * @param contentSysId
	 * @param relationId
	 * @return
	 */
	public Content2Category findContentLeafCategoryBy(long contentSysId, Integer relationId);

	public void deleteContent2Category(long content2CategorySysId);

	/**
	 * 
	 * @param contentSysId
	 *            -1:all
	 * @param relationIds
	 *            null:all
	 * @param categorySysId
	 *            -1:all
	 * @param statusIds
	 *            null:all
	 * @param contentTypeIds
	 *            null:all
	 * @param pgno
	 *            >=0
	 * @param pgsize
	 *            >0
	 * @param orderByFieldIds
	 *            null:none else list of Fields of Content2Category
	 * @return
	 */
	public List<Content2Category> getListContent2CategoryBy(long contentSysId, Integer[] relationIds,
			long categorySysId, Integer[] statusIds, Integer[] contentTypeIds, int pgno, int pgsize, String orderBy);

	/**
	 * 
	 * @param contentSysId
	 * @param relationIds
	 * @param categorySysId
	 * @param statusIds
	 * @param contentTypeIds
	 * @return
	 */
	public long getCountContent2CategoryBy(long contentSysId, Integer[] relationIds, long categorySysId,
			Integer[] statusIds, Integer[] contentTypeIds);

	/**
	 * 
	 * @param contentId
	 * @param relationIds
	 * @param categoryId
	 * @param brandCategoryId
	 * @param statusIds
	 * @param contentTypeIds
	 * @param pgno
	 * @param pgsize
	 * @param orderBy
	 * @return
	 */
	public List<Content2Category> getListContent2CategoryBy(String contentId, Integer[] relationIds, String categoryId,
			String brandCategoryId, Integer[] statusIds, Integer[] contentTypeIds, int pgno, int pgsize, String orderBy);

	public List<Content2Category> getListContent2CategoryWithScalarBy(String contentId, Integer[] relationIds,
			String categoryId, String brandCategoryId, String[] statusIds, String[] contentTypeIds, int pgno,
			int pgsize, String orderBy);

	/**
	 * 
	 * @param contentId
	 * @param relationIds
	 * @param categoryId
	 * @param brandCategoryId
	 * @param statusIds
	 * @param contentTypeIds
	 * @return
	 */
	public Long getCountContent2CategoryBy(String contentId, Integer[] relationIds, String categoryId,
			String brandCategoryId, Integer[] statusIds, Integer[] contentTypeIds);

	// --------------------------/Content2Category--------------------------

	public Content2Content findContent2ContentBy(long content2ContentSysId);

	public Content2Content saveContent2Content(Content2Content content2Content);

	// ------------content2content
	public List<Content2Content> getListContent2ContentBy(long contentSysId, String[] relationIds, String[] statusIds,
			long contentSysId2, int pgno, int pgsize, String orderBy);

	public long getCountContent2ContentBy(long contentSysId, String[] relationIds, String[] statusIds,
			long contentSysId2);

	public List<Content2Content> getListContent2ContentBy(String contentId, Integer[] relationIds, Integer[] statusIds,
			String contentId2, int pgno, int pgsize, String orderBy);

	public long getCountContent2ContentBy(String contentId, Integer[] relationIds, Integer[] statusIds, String contentId2);

}
